﻿<DataListSpec 
	xmlns="bb_appfx_datalist"
	xmlns:common="bb_appfx_commontypes" 
	ID="02f8c9cb-18ad-478a-bc12-4bcd22e36fa0" 
	Name="Revenue For Constituent Data List"
	Description="Get Revenue records associated with a Constituent." 
	Author="Blackbaud Professional Services"
	common:SecurityUIFolder="Service Bus Adapter">

  <!-- define the SP that returns the data for the datalist -->
  <SPDataList SPName="USP_DATALIST_REVENUEFORCONSTITUENT">
    <common:CreateProcedureSQL>
      <![CDATA[
create procedure dbo.USP_DATALIST_REVENUEFORCONSTITUENT(
  @CONSTITUENTID uniqueidentifier)
as
	set nocount on;
  
SELECT
  r.ID,
	r.CONSTITUENTID,
  r.DATE as REVENUEDATE,
  r.POSTDATE,
  
  r.DONOTPOST,
  r.DONOTRECEIPT,
  r.RECEIPTAMOUNT,
  r.AMOUNT,
  
  r.SOURCECODE,
  r.FINDERNUMBER,
  r.GIVENANONYMOUSLY,
  r.DONOTACKNOWLEDGE,
  
  r.BENEFITSWAIVED,
  r.DATEADDED,
  r.DATECHANGED,
  r.RECEIPTTYPECODE,
  
  r.NEEDSRERECEIPT,
  r.TRANSACTIONTYPECODE,
  r.DESCRIPTION,
  r.ELIGIBLEFORMATCHINGGIFTCLAIM,
  
  r.CUSTOMIDENTIFIER,
  r.SEQUENCEID,
  r.LOOKUPID,
  r.ISREIMBURSABLE,
  
  r.RECEIPTTYPE,
  r.ORGANIZATIONAMOUNT,
  r.TRANSACTIONAMOUNT,
  r.TRANSACTIONTYPE,


/* Translated */
ca.USERNAME as CHANGEDBYUSERNAME


/* Add as needed
,
r.APPEALID,
r.MAILINGID,
r.CHANNELCODEID,
r.TRANSACTIONCURRENCYID,
r.ORGANIZATIONEXCHANGERATEID,
r.BASEEXCHANGERATEID,
r.BASECURRENCYID,

*/

  
FROM REVENUE r
  LEFT OUTER JOIN CHANGEAGENT ca  ON ca.ID = r.CHANGEDBYID
WHERE r.CONSTITUENTID = @CONSTITUENTID
ORDER BY SEQUENCEID
  

			]]>
    </common:CreateProcedureSQL>
  </SPDataList>

  <!-- describe any parameters (other than the context ID) defined on the SP -->
  <Parameters>
    <common:FormMetaData>
      <common:FormFields>
        <common:FormField FieldID="CONSTITUENTID" Caption="Constituent ID" DataType="Guid"/>
      </common:FormFields>
    </common:FormMetaData>
  </Parameters>

  <!-- define the output fields in the list -->
  <Output>
    <OutputFields>
      <!-- 0 -->
      <OutputField FieldID="ID" Caption="ID" DataType="Guid" IsHidden="true" />
      <!-- 1 -->
      <OutputField FieldID="CONSTITUENTID" Caption="Constituent ID" DataType="Guid" />
      <!-- 2 -->
      <OutputField FieldID="REVENUEDATE" Caption="Revenue Date" DataType="Date" />
      <!-- 3 -->
      <OutputField FieldID="POSTDATE" Caption="Post Date" DataType="Date" />
      
      <!-- 4 -->
      <OutputField FieldID="DONOTPOST" Caption="Do Not Post" DataType="Boolean" />
      <!-- 5 -->
      <OutputField FieldID="DONOTRECEIPT" Caption="Do Not Receipt" DataType="Boolean" />
      <!-- 6 -->
      <OutputField FieldID="RECEIPTAMOUNT" Caption="Receipt Amount" DataType="Money" />
      <!-- 7 -->
      <OutputField FieldID="AMOUNT" Caption="Amount" DataType="Money" />
      
      <!-- 8 -->
      <OutputField FieldID="SOURCECODE" Caption="Source Code" DataType="String" />
      <!-- 9 -->
      <OutputField FieldID="FINDERNUMBER" Caption="Finder Number" DataType="Integer" />
      <!-- 10 -->
      <OutputField FieldID="GIVENANONYMOUSLY" Caption="Give Anonymously" DataType="Boolean" />
      <!-- 11 -->
      <OutputField FieldID="DONOTACKNOWLEDGE" Caption="Do Not Acknowledge" DataType="Boolean" />      

      <!-- 12 -->
      <OutputField FieldID="BENEFITSWAIVED" Caption="Benefits Waived" DataType="Boolean" />
      <!-- 13 -->
      <OutputField FieldID="DATEADDED" Caption="Date Added" DataType="Date" />
      <!-- 14 -->
      <OutputField FieldID="DATECHANGED" Caption="Date Changed" DataType="Date" />
      <!-- 15 -->
      <OutputField FieldID="RECEIPTTYPECODE" Caption="Receipt Type Code" DataType="TinyInt" />

      <!-- 16 -->
      <OutputField FieldID="NEEDSRERECEIPT" Caption="Need Re-Receipt" DataType="Boolean" />
      <!-- 17 -->
      <OutputField FieldID="TRANSACTIONTYPECODE" Caption="Transaction Type Code" DataType="TinyInt" />
      <!-- 18 -->
      <OutputField FieldID="DESCRIPTION" Caption="Description" DataType="String" />
      <!-- 19 -->
      <OutputField FieldID="ELIGIBLEFORMATCHINGGIFTCLAIM" Caption="Eligible for Matching Gift Claim" DataType="Boolean" />
      
      <!-- 20 -->
      <OutputField FieldID="CUSTOMIDENTIFIER" Caption="Custom Identifier" DataType="String" />
      <!-- 21 -->
      <OutputField FieldID="SEQUENCEID" Caption="Sequence Id" DataType="Integer" />
      <!-- 22 -->
      <OutputField FieldID="LOOKUPID" Caption="Lookup Id" DataType="String" />
      <!-- 23 -->
      <OutputField FieldID="ISREIMBURSABLE" Caption="Is Reimbursable" DataType="Boolean" />
      
      <!-- 24 -->
      <OutputField FieldID="RECEIPTTYPE" Caption="Receipt Type" DataType="String" />
      <!-- 25 -->
      <OutputField FieldID="ORGANIZATIONAMOUNT" Caption="Organization Amount" DataType="Money" />
      <!-- 26 -->
      <OutputField FieldID="TRANSACTIONAMOUNT" Caption="Transaction Amount" DataType="Money" />
      <!-- 27 -->
      <OutputField FieldID="TRANSACTIONTYPE" Caption="Transaction Type" DataType="String" />

      <!-- 27 -->
      <OutputField FieldID="CHANGEDBYUSERNAME" Caption="Changed By User Name" DataType="String" />      
    </OutputFields>
  </Output>
</DataListSpec>